package com.hanrui.android.fragment.message.audit.probusinfo;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hanrui.android.R;
import com.hanrui.android.activity.download.MyDownLoadActivity;
import com.hanrui.android.library.base.BaseFragment;
import com.hanrui.android.model.ProBusInfoDetailBean;
import com.hanrui.android.net.contract.message.audit.probusinfo.ProBusInfoDetailContract;
import com.hanrui.android.net.presenter.message.audit.probusinfo.ProBusInfoDetailPresenter;

import butterknife.BindView;

/**
 * 任务书基本信息
 *
 */

public class ProBusInfoDetailFragment extends BaseFragment<ProBusInfoDetailPresenter> implements ProBusInfoDetailContract.View {
    @BindView(R.id.main_title)
    TextView mainTitle;
    @BindView(R.id.subhead_title)
    TextView subheadTitle;
    @BindView(R.id.enclosure_ll)
    LinearLayout enclosureLl;
    @BindView(R.id.enclosure)
    ImageView enclosure;
    @BindView(R.id.name)
    TextView name;
    @BindView(R.id.thing_title)
    TextView thingTitle;
    @BindView(R.id.time)
    TextView time;
    @BindView(R.id.page_num)
    TextView pageNum;
    @BindView(R.id.duty_people)
    TextView dutyPeople;
    @BindView(R.id.copies_num)
    TextView copiesNum;
    @BindView(R.id.vote_meet)
    TextView voteMeet;
    @BindView(R.id.money_meet)
    TextView moneyMeet;
    @BindView(R.id.wind_meet)
    TextView windMeet;
    @BindView(R.id.receipt_num)
    TextView receiptNum;
    @BindView(R.id.receipt_page)
    TextView receiptPage;
    @BindView(R.id.batch_num)
    TextView batchNum;
    @BindView(R.id.is_akey)
    TextView isAkey;
    @BindView(R.id.measure_area)
    TextView measureArea;
    @BindView(R.id.collection_num)
    TextView collectionNum;
    @BindView(R.id.money_time)
    TextView moneyTime;
    @BindView(R.id.collection_time)
    TextView collectionTime;
    @BindView(R.id.transfer_time)
    TextView transferTime;
    @BindView(R.id.transfer_thing)
    TextView transferThing;
    @BindView(R.id.total)
    TextView total;
    @BindView(R.id.down_money)
    TextView downMoney;
    @BindView(R.id.collection_house)
    TextView collectionHouse;
    @BindView(R.id.rodline_transfer)
    TextView rodlineTransfer;
    @BindView(R.id.engineering_money)
    TextView engineeringMoney;
    @BindView(R.id.main_build)
    TextView main_build;
    @BindView(R.id.starttime)
    TextView starttime;
    @BindView(R.id.endtime)
    TextView endtime;
    @BindView(R.id.design_company)
    TextView designCompany;
    @BindView(R.id.address_user)
    TextView addressUser;
    @BindView(R.id.address_phone)
    TextView addressPhone;
    @BindView(R.id.remarks)
    TextView remarks;
    @BindView(R.id.review_type)
    TextView reviewType;
    @BindView(R.id.subject_entry)
    TextView subjectEntry;
    @BindView(R.id.subject_main)
    TextView subjectMain;
    @BindView(R.id.person_charge)
    TextView personCharge;
    @BindView(R.id.party_a)
    TextView partyA;
    @BindView(R.id.enclosure_num)
    TextView enclosureNum;

    String taskId,procInsId,bizId;

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_probusinfodetail;
    }

    @Override
    protected void initInjector() { mFragmentComponent.inject(this); }

    @Override
    protected void initView(View view) {

        taskId = getArguments().getString("taskId");
        procInsId = getArguments().getString("procInsId");
        bizId = getArguments().getString("bizId");

        mPresenter.proBusInfoBizDetail(getActivity(),taskId,procInsId,bizId);

    }



    public static ProBusInfoDetailFragment newInstance(String taskId, String procInsId, String bizId) {
        ProBusInfoDetailFragment fragment = new ProBusInfoDetailFragment();
        Bundle bundle = new Bundle();
        bundle.putString("taskId", taskId);
        bundle.putString("procInsId", procInsId);
        bundle.putString("bizId", bizId);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public void proBusInfoBizDetail(final ProBusInfoDetailBean data) {

        if (null != data) {

            mainTitle.setText(data.getDetail().getSourceType()+"任务书审批");

            if (null != data.getFiles() && data.getFiles().size() > 0) {

                enclosureLl.setVisibility(View.VISIBLE);
                enclosureNum.setText("["+data.getFiles().size()+"]");
                enclosure.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                        MyDownLoadActivity.start(getActivity(),data.getFiles());

                    }
                });
            }

            name.setText(data.getDetail().getSourceType());
            thingTitle.setText(data.getDetail().getNo());
            time.setText(data.getDetail().getYear());
            pageNum.setText(data.getDetail().getProType());
            dutyPeople.setText(data.getDetail().getAttrTypeName());
            copiesNum.setText(data.getDetail().getName());
            voteMeet.setText(data.getDetail().getContent());
            moneyMeet.setText(data.getDetail().getPlaneType());
            windMeet.setText(data.getDetail().getOperaType());
            receiptNum.setText(data.getDetail().getLead());
            receiptPage.setText(data.getDetail().getProAttrType());
            batchNum.setText(data.getDetail().getLxpfh());
            isAkey.setText(data.getDetail().getIsImportant());
            measureArea.setText(data.getDetail().getLandArea());
            collectionNum.setText(data.getDetail().getHosLevyQuanty());
            moneyTime.setText(data.getDetail().getRecoverTime());
            collectionTime.setText(data.getDetail().getHosLevyCompTime());
            transferTime.setText(data.getDetail().getWordTransTime());
            transferThing.setText(data.getDetail().getWrodTransContent());
            total.setText(data.getDetail().getContractEstPrice());
            downMoney.setText(data.getDetail().getCompensEstPrice());
            collectionHouse.setText(data.getDetail().getHslevyEstPrice());
            rodlineTransfer.setText(data.getDetail().getWmigratEstPrice());
            engineeringMoney.setText(data.getDetail().getProEstPrice());
            main_build.setText(data.getDetail().getBuildContruct());
            starttime.setText(data.getDetail().getProStartTime());
            endtime.setText(data.getDetail().getProCompletTime());
            designCompany.setText(data.getDetail().getDesignCompany());
            addressUser.setText(data.getDetail().getContacts());
            addressPhone.setText(data.getDetail().getContactWay());
            remarks.setText(data.getDetail().getRemarks());
            reviewType.setText(data.getDetail().getIsExamine());
            subjectEntry.setText(data.getDetail().getProSubject());
            subjectMain.setText(data.getDetail().getImpSubject());
            personCharge.setText(data.getDetail().getProLeader());
            partyA.setText(data.getDetail().getProDelegate());

        }

    }


}
